<template>
    <div class="community">
        <Address/>
        <van-tabs v-model:active="active">
    <van-tab title="推荐">
      <van-list
        v-model:loading="loading"
        :finished="finished"
        finished-text="没有更多了"
        @load="onLoad"
      >
        
      </van-list></van-tab
    >
    <van-tab title="关注">
      <van-list
        v-model:loading="loading"
        :finished="finished"
        finished-text="没有更多了"
        @load="onLoad"
      >
        </van-list
      ></van-tab
    >
    <van-tab title="最新">
      <van-list
        v-model:loading="loading"
        :finished="finished"
        finished-text="没有更多了"
        @load="onLoad"
      >
        </van-list
      ></van-tab
    >
  </van-tabs>
    </div>
</template>

<script setup lang="ts">
import Address from "./homepageitem/Address.vue";
import { ref } from "vue";
const active = ref(0);

const list = ref<any>([]);
const loading = ref(false);
const finished = ref(false);

const onLoad = () => {
  setTimeout(() => {
    for (let i = 0; i < 10; i++) {
      list.value.push(list.value.length + 1);
    }

    // 加载状态结束
    loading.value = false;

    // 数据全部加载完成
    if (list.value.length >= 40) {
      finished.value = true;
    }
  }, 1000);
};
</script>

<style scoped lang="scss">
.community{
    width: 100%;
}
</style>